<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>生命周期函数</title>
</head>
<body>
<div id="app">{{content}}</div>
<script src="../vue.js"></script>
<script>
    let vm = new Vue({
        el:'#app',
        //实例创建之前
        beforeCreate(){
            /*
                %s:css的占位符
                %s:string的占位符
            */
            console.group('=====created=====实例创建之前');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        //已经创建  Dom还没挂载上来，用来请求数据（接口请求）
        created(){
            console.group('=====created=====已经创建');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        // 挂载之前
        beforeMount(){
            console.group('=====created=====挂载之前');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        //挂载之后
        mounted(){
            console.group('=====created=====挂载之后');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        //更新之前  内容改变时执行
        beforeUpdate(){
            console.group('=====created=====更新之前');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        //更新之后
        updated(){
            console.group('=====created=====更新之后');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        //销毁之前  销毁与父子组件的所有联系，
        beforeDestroy(){
            console.group('=====created=====销毁之前');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        //销毁之后  销毁后就无法在对绑定的实例里做任何操作
        destroyed(){
            console.group('=====created=====销毁之后');
            console.log('%c%s','color:red','this.$data=>'+this.$data);
            console.log('%c%s','color:red','this.$el=>'+this.$el);
            console.log('%c%s','color:red','this.$content=>'+this.content);
        },
        data(){
            return {
                content:'你死哦恶女就'
            }
        }
    })
</script>

</body>
</html>